using System.ComponentModel.DataAnnotations;
using S.M.SmartMedical.Domain.Enums;

namespace S.M.SmartMedical.Domain.Entities
{
    /// <summary>
    /// 开单申请实体
    /// 用于存储用户提交的开单申请信息
    /// </summary>
    public class OrderApplication : BaseEntity
    {
        /// <summary>
        /// 申请编号（系统自动生成）
        /// </summary>
        [Required]
        [MaxLength(50)]
        public string ApplicationNumber { get; set; } = string.Empty;

        /// <summary>
        /// 申请用户ID
        /// </summary>
        [Required]
        public int UserId { get; set; }

        /// <summary>
        /// 申请用户（导航属性）
        /// </summary>
        public virtual User User { get; set; } = null!;

        /// <summary>
        /// 院区ID
        /// </summary>
        [Required]
        public int HospitalAreaId { get; set; }

        /// <summary>
        /// 院区（导航属性）
        /// </summary>
        public virtual HospitalArea HospitalArea { get; set; } = null!;

        /// <summary>
        /// 申请状态
        /// </summary>
        [Required]
        public OrderApplicationStatus Status { get; set; } = OrderApplicationStatus.Pending;

        /// <summary>
        /// 项目总数量
        /// </summary>
        [Required]
        public int ProjectCount { get; set; }

        /// <summary>
        /// 总金额（单位：元）
        /// </summary>
        [Required]
        public decimal TotalAmount { get; set; }

        /// <summary>
        /// 申请备注
        /// </summary>
        [MaxLength(500)]
        public string? Remarks { get; set; }

        /// <summary>
        /// 预约日期
        /// </summary>
        public DateTime? AppointmentDate { get; set; }

        /// <summary>
        /// 预约时间段
        /// </summary>
        [MaxLength(20)]
        public string? AppointmentTimeSlot { get; set; }

        /// <summary>
        /// 联系电话
        /// </summary>
        [MaxLength(20)]
        public string? ContactPhone { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? ReviewTime { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        [MaxLength(50)]
        public string? ReviewerName { get; set; }

        /// <summary>
        /// 审核意见
        /// </summary>
        [MaxLength(500)]
        public string? ReviewComments { get; set; }

        /// <summary>
        /// 支付时间
        /// </summary>
        public DateTime? PaymentTime { get; set; }

        /// <summary>
        /// 支付方式
        /// </summary>
        [MaxLength(50)]
        public string? PaymentMethod { get; set; }

        /// <summary>
        /// 支付交易号
        /// </summary>
        [MaxLength(100)]
        public string? PaymentTransactionId { get; set; }

        /// <summary>
        /// 申请项目列表（导航属性）
        /// </summary>
        public virtual ICollection<OrderApplicationItem> Items { get; set; } = new List<OrderApplicationItem>();
    }
}